home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 20
/
AMIGAplus Sonderheft 20 (1999)(ICP)(DE)[!].iso
/
PublicDomain
/
Alternatives
/
LinuxAPUS
/
Linux.aux
< prev
next >
Wrap
Text File
|
1999-01-01
|
14KB
|
421 lines
/*
* Linux.aux - auxiliary rx script for Linux launcher
*
* $VER: Linux.aux revision 1 (25.02.99) Duncan Gibb
*
* Based on UAEWB.aux 0.2 (26.01.98) © by Samuel Devulder
*
* Usage: Linux.aux [default|about|use|save|saveas <filename>|open <filename>]
*/
/* The following are used in the two default config settings
*/
trace all
DEFAULT_KERNEL = 'Kernels/vmlinux'
DEFAULT_TEST_RAMDISK = 'RAMDisks/ramdisk.image.gz'
DEFAULT_REDHAT_RAMDISK = 'RAMDisks/apus-rh-ramdisk.image990103.gz'
/*
**
*/
if ~show('p','LINUX') then do
if exists("c:Requestchoice") then address command 'C:RequestChoice >nil: Linux.aux "Please use the Linux.rexx script which provides a GUI" "OK"'
else address command 'Echo >"CON://320/50/Linux.aux/WAIT/CLOSE" "Please use the Linux.rexx script which provides a GUI" "OK"'
exit(121) /* Not executable ;-) */
end
MUIA_Background = 0x8042545b
MUIA_ControlChar = 0x8042120b
MUIA_Frame = 0x8042ac64
MUIA_Text_HiChar = 0x804218ff
MUIA_Window_DepthGadget = 0x80421923
MUIA_Window_DragBar = 0x8042045d
MUIA_Window_SizeGadget = 0x8042e33d
MUII_WindowBack = 0
MUIV_Frame_None = 0
FALSE = 0
OPTIONS RESULTS
PARSE ARG ACTION FILENAME .
ACTION=upper(ACTION)
if (left(FILENAME,1) = '"') & (right(FILENAME,1) = '"') then FILENAME=substr(FILENAME,2,length(FILENAME)-2)
ADDRESS LINUX
/* This is the default place to load and save stuff */
LINUXPREFS = "ENV:LINUX_CONFIG"
/* 'DEFAULT' set prefs to default for testing the kernel */
IF ACTION='DEFAULT' THEN DO
POPASL ID KERNL CONTENT DEFAULT_KERNEL
CHECK ID APUS ATTRS 0X8042654B "1"
CHECK ID NOBAT ATTRS 0X8042654B "1"
CHECK ID 60NS ATTRS 0X8042654B "0"
CYCLE ID AMIFB LABEL "Not specified"
SLIDER ID ADEPT ATTRS 0X8042AE3A "4"
CYCLE ID PM2FB LABEL "Not specified"
CHECK ID PM2OM ATTRS 0X8042654B "0"
CYCLE ID VIRGE LABEL "Not specified"
CYCLE ID CYBER LABEL "Not specified"
CYCLE ID CLGEN LABEL "Not specified"
CYCLE ID RETZ3 LABEL "Not specified"
POPLIST ID ROOT CONTENT "/dev/ram"
POPASL ID RAMDI CONTENT DEFAULT_TEST_RAMDISK
POPLIST ID BOPTS CONTENT ""
POPLIST ID KOPTS CONTENT ""
EXIT 0
END
/* This sets up to run the RedHat installer from a ramdisk image */
IF ACTION='DEFAULT_REDHAT' THEN DO
POPASL ID KERNL CONTENT DEFAULT_KERNEL
CHECK ID APUS ATTRS 0X8042654B "1"
CHECK ID NOBAT ATTRS 0X8042654B "1"
CHECK ID 60NS ATTRS 0X8042654B "0"
CYCLE ID AMIFB LABEL "Not specified"
SLIDER ID ADEPT ATTRS 0X8042AE3A "4"
CYCLE ID PM2FB LABEL "Not specified"
CHECK ID PM2OM ATTRS 0X8042654B "0"
CYCLE ID VIRGE LABEL "Not specified"
CYCLE ID CYBER LABEL "Not specified"
CYCLE ID CLGEN LABEL "Not specified"
CYCLE ID RETZ3 LABEL "Not specified"
POPLIST ID ROOT CONTENT "/dev/ram"
POPASL ID RAMDI CONTENT DEFAULT_REDHAT_RAMDISK
POPLIST ID BOPTS CONTENT ""
POPLIST ID KOPTS CONTENT ""
EXIT 0
END
IF ACTION='ABOUT' THEN DO
WINDOW ID ABOUT ATTRS MUIA_Window_DepthGadget FALSE,
MUIA_Window_DragBar FALSE MUIA_Window_SizeGadget FALSE
GROUP HORIZ
BUTTON ICON "Linux Launcher" TRANS ATTRS MUIA_Background MUII_WindowBack MUIA_Frame MUIV_Frame_None
TEXT ATTRS MUIA_Background MUII_WindowBack MUIA_Frame MUIV_Frame_None,
LABEL "\033c"||,
"Linux is a Unix-like operating system.\n\n"||,
"This launcher is designed for Linux/APUS - a PowerPC version for Amigas\n"||,
"with phase5 PowerUP boards - but should work with Amiga Linux-M68K.\n\n"||,
"Please refer to\nhttp://sunsite.auc.dk/pub/os/linux/apus/docs/faq.html\n"||,
"http://www.linux-m68k.org/\n\n"||,
"Launcher by Duncan Gibb\n"||,
"Based on UAEWB by Samuel Devulder\n"||,
"This GUI uses MUIRexx by Russell Leighton"
ENDGROUP
GROUP HORIZ
SPACE HORIZ
BUTTON ID OK_BUTT COMMAND """WINDOW ID ABOUT CLOSE""" PORT LINUX ATTRS MUIA_ControlChar 13 LABEL "Ok"
SPACE HORIZ
ENDGROUP
ENDWINDOW
EXIT 0
END
IF ACTION='OPEN' THEN DO
/* Load a previously saved config */
if ~open(FILE_TO_LOAD, FILENAME, "r") then do
ADDRESS LINUX
WINDOW ID WRONGFILE ATTRS MUIA_Window_DepthGadget FALSE,
MUIA_Window_DragBar FALSE MUIA_Window_SizeGadget FALSE
GROUP HORIZ
BUTTON ICON "Linux Launcher" TRANS ATTRS MUIA_Background MUII_WindowBack MUIA_Frame MUIV_Frame_None
TEXT ATTRS MUIA_Background MUII_WindowBack MUIA_Frame MUIV_Frame_None,
LABEL "\033cConfig file '"FILENAME"' could not be opened.\nDoes it exist?"
ENDGROUP
GROUP HORIZ
SPACE HORIZ
BUTTON ID OK_BUTT COMMAND """WINDOW ID WRONGFILE CLOSE""" PORT LINUX ATTRS MUIA_ControlChar 13 LABEL "Oops"
SPACE HORIZ
ENDGROUP
ENDWINDOW
close(FILE_TO_LOAD)
EXIT 255
end
if ~(readln(FILE_TO_LOAD) = '/*LINUXPREFS*/') then do
ADDRESS LINUX
WINDOW ID WRONGFILE ATTRS MUIA_Window_DepthGadget FALSE,
MUIA_Window_DragBar FALSE MUIA_Window_SizeGadget FALSE
GROUP HORIZ
BUTTON ICON "Linux Launcher" TRANS ATTRS MUIA_Background MUII_WindowBack MUIA_Frame MUIV_Frame_None
TEXT ATTRS MUIA_Background MUII_WindowBack MUIA_Frame MUIV_Frame_None,
LABEL "\033cFile '"FILENAME"' is not a Linux Launcher config file."
ENDGROUP
GROUP HORIZ
SPACE HORIZ
BUTTON ID OK_BUTT COMMAND """WINDOW ID WRONGFILE CLOSE""" PORT LINUX ATTRS MUIA_ControlChar 13 LABEL "Oops"
SPACE HORIZ
ENDGROUP
ENDWINDOW
close(FILE_TO_LOAD)
EXIT 255
end
close(FILE_TO_LOAD)
ADDRESS COMMAND
'rx 'FILENAME''
EXIT 0
END
if ACTION='SAVEAS' then do
/* Save to a user-specified file */
if ~open(ENVFILE, FILENAME, "w") then do
ADDRESS LINUX
WINDOW ID NOSAVE ATTRS MUIA_Window_DepthGadget FALSE,
MUIA_Window_DragBar FALSE MUIA_Window_SizeGadget FALSE
GROUP HORIZ
BUTTON ICON "Linux Launcher" TRANS ATTRS MUIA_Background MUII_WindowBack MUIA_Frame MUIV_Frame_None
TEXT ATTRS MUIA_Background MUII_WindowBack MUIA_Frame MUIV_Frame_None,
LABEL "\033cCould not save to your file "FILENAME"."
ENDGROUP
GROUP HORIZ
SPACE HORIZ
BUTTON ID OK_BUTT COMMAND """WINDOW ID NOSAVE CLOSE""" PORT LINUX ATTRS MUIA_ControlChar 13 LABEL "Oh dear"
SPACE HORIZ
ENDGROUP
ENDWINDOW
EXIT 255
end
save_config()
close(ENVFILE)
exit(0)
end
/* Should be use, save or exit*/
if ~((ACTION='USE')|ACTION='SAVE'|ACTION='EXIT') then do
ADDRESS LINUX
WINDOW ID WRONGACTION ATTRS MUIA_Window_DepthGadget FALSE,
MUIA_Window_DragBar FALSE MUIA_Window_SizeGadget FALSE
GROUP HORIZ
BUTTON ICON "Linux Launcher" TRANS ATTRS MUIA_Background MUII_WindowBack MUIA_Frame MUIV_Frame_None
TEXT ATTRS MUIA_Background MUII_WindowBack MUIA_Frame MUIV_Frame_None,
LABEL "\033cThe action "ACTION" is not recognised."
ENDGROUP
GROUP HORIZ
SPACE HORIZ
BUTTON ID OK_BUTT COMMAND """WINDOW ID WRONGACTION CLOSE""" PORT LINUX ATTRS MUIA_ControlChar 13 LABEL "Oops"
SPACE HORIZ
ENDGROUP
ENDWINDOW
exit(236) /* Not implemented */
end
WINDOW ID WAIT ATTRS 0x80421923 0 0x8042045d 0
if ACTION='EXIT' then LABEL "\033b\033cPlease wait\nwhile Linux config is saved...\033n"
else LABEL "\033b\033cPlease wait\nwhile Linux loads and boots...\033n"
ENDWINDOW
if ~OPEN(ENVFILE,LINUXPREFS,"w") then do
ADDRESS LINUX
WINDOW ID NOSAVE ATTRS MUIA_Window_DepthGadget FALSE,
MUIA_Window_DragBar FALSE MUIA_Window_SizeGadget FALSE
GROUP HORIZ
BUTTON ICON "Linux Launcher" TRANS ATTRS MUIA_Background MUII_WindowBack MUIA_Frame MUIV_Frame_None
TEXT ATTRS MUIA_Background MUII_WindowBack MUIA_Frame MUIV_Frame_None,
LABEL "\033cCould not save config to "FILENAME"."
ENDGROUP
GROUP HORIZ
SPACE HORIZ
BUTTON ID OK_BUTT COMMAND """WINDOW ID NOSAVE CLOSE""" PORT LINUX ATTRS MUIA_ControlChar 13 LABEL "Oops"
SPACE HORIZ
ENDGROUP
ENDWINDOW
EXIT 255
end
save_config()
call CLOSE(ENVFILE)
/* if user selected 'save' or 'exit', copy the prefs file to ENVARC: */
if (ACTION='SAVE' | ACTION='EXIT') then address COMMAND "copy "linuxprefs" ENVARC: noreq quiet"
/* Kill the front end */
WINDOW ID MAIN CLOSE
WINDOW ID WAIT CLOSE
QUIT
if ACTION='EXIT' then exit(0)
/* create bootstrap command line */
line = ""
/* APUSness first */
if (APUS ~= "") then line = line '--apus'
/* Name the kernel */
if (KERNELNAME = "") then do
if exists("C:RequestChoice") then address command 'C:RequestChoice "Linux Launcher" "You must specify a kernel." "Cancel"'
else address command 'echo >"CON://320/50/Linux Launcher/WAIT/CLOSE" "You must specify a kernel."'
exit(116) /* Req arg missing */
end
if (~exists(KERNELNAME)) then do
if exists("C:RequestChoice") then address command 'C:RequestChoice "Linux Launcher" "Kernel image '''|| KERNELNAME ||''' was not found." "Cancel"'
else address command 'echo >"CON://320/50/Linux Launcher/WAIT/CLOSE" "Kernel image '''|| KERNELNAME ||'''was not found."'
exit(205) /* Object not found */
end
line = line '-k' KERNELNAME
/* Is a RAM disk image required? */
if ((RAM_DISK ~= "") & (~exists(RAM_DISK))) then do
if exists("C:RequestChoice") then address command 'C:RequestChoice "Linux Launcher" "RAM disk image '''|| RAM_DISK ||''' was not found." "Cancel"'
else address command 'echo >"CON://320/50/Linux Launcher/WAIT/CLOSE" "RAM disk image '''|| RAM_DISK ||'''was not found."'
exit(205) /* Object not found */
end
if (RAM_DISK ~= "") then line = line '-r' RAM_DISK
/* Virge can't do its own init yet */
if (VIRGE_MODE ~= 'Not specified') then line = line "--keep-video"
/* Tack on user's own bootstrap options */
line = line STRAP_OPTS
/*
** Here endeth the BootStrap options
** Kernel options follow
*/
if NOBATS then line = line 'nobats'
if RAM60NS then line = line '60nsram'
if (ROOT_PART ~= "") then line = line 'root=' || ROOT_PART
/* video options */
if (PM2FB_MODE ~= 'Not specified') then do
line = line 'video=pm2fb:' || PM2FB_MODE
if (PM2FB_OLDMEM = "1") then line = line || ',oldmem'
end
if (VIRGE_MODE ~= 'Not specified') then line = line 'video=virge:' || VIRGE_MODE
if (CYBER_MODE ~= 'Not specified') then line = line 'video=cyber:' || CYBER_MODE
if (CLGEN_MODE ~= 'Not specified') then do
line = line 'video=clgen'
if (CLGEN_MODE ~= 'Use AmigaOS mode') then line = line || ':' || CLGEN_MODE
end
if (RETZ3_MODE ~= 'Not specified') then line = line 'video=retz3:' || RETZ3_MODE
/* Put AmiFB last on the assumption you want gfx card as fb0 */
/* AmiFB can't be specified without giving a depth */
/* NB: No way to check if depth is valid */
if (AMIFB_MODE = 'Auto') then line = line 'video=amifb:depth:' || AMIFB_DEPTH
if (AMIFB_MODE = 'off') then line = line 'video=amifb:off'
if (AMIFB_MODE ~= 'Not specified') & ((AMIFB_MODE ~= 'Auto') & (AMIFB_MODE ~= 'off')) then line = line 'video=amifb:' || AMIFB_MODE || ',depth:' || AMIFB_DEPTH
/* That's all that can be configured with the GUI
** Add on user kernel options
*/
line = line KERNEL_OPTS
/* Launch the kernel */
ADDRESS COMMAND
'echo >T:LINUX_LAUNCH_SCRIPT "echo *"**n**nLaunching with**n**n : BootStrap 'line'**n**n*""'
'echo >>T:LINUX_LAUNCH_SCRIPT "BootStrap 'line'"'
'NewShell con:/15//999/Linux_Launch/close/wait from t:LINUX_LAUNCH_SCRIPT'
exit(0)
/* GET value and update prefs */
get_val: PROCEDURE
PARSE ARG CMD, SET
address LINUX CMD
GVAL=RESULT
call writeln(ENVFILE,CMD SET '"'||GVAL'"')
return GVAL
save_config: PROCEDURE,
EXPOSE KERNELNAME APUS NOBATS RAM60NS,
AMIFB_MODE AMIFB_DEPTH PM2FB_MODE PM2FB_OLDMEM,
VIRGE_MODE CYBER_MODE CLGEN_MODE RETZ3_MODE,
ROOT_PART RAM_DISK STRAP_OPTS KERNEL_OPTS
/* Let's have some globals ;-) */
/* Some MUI Tags which may be useful */
Cycle_Active = 0x80421788
Selected = 0x8042654B
Slider_Level = 0x8042AE3A
/* Config file is an Arexx script.
** Since "loading" it is actually _running_ it,
** use a specific first line as an identifier
*/
call writeln(ENVFILE,"/*LINUXPREFS*/");
call writeln(ENVFILE,"ADDRESS LINUX")
/* Kernel */
KERNELNAME = get_val("POPASL ID KERNL", CONTENT)
APUS = get_val("CHECK ID APUS ATTRS" Selected,"")
NOBATS = get_val("CHECK ID NOBAT ATTRS" Selected,"")
RAM60NS = get_val("CHECK ID 60NS ATTRS" Selected,"")
/* Display */
AMIFB_MODE = get_val("CYCLE ID AMIFB", LABEL)
AMIFB_DEPTH = get_val("SLIDER ID ADEPT ATTRS" Slider_Level,"")
PM2FB_MODE = get_val("CYCLE ID PM2FB", LABEL)
PM2FB_OLDMEM= get_val("CHECK ID PM2OM ATTRS" Selected, "")
VIRGE_MODE = get_val("CYCLE ID VIRGE", LABEL)
CYBER_MODE = get_val("CYCLE ID CYBER", LABEL)
CLGEN_MODE = get_val("CYCLE ID CLGEN", LABEL)
RETZ3_MODE = get_val("CYCLE ID RETZ3", LABEL)
/* Disks */
ROOT_PART = get_val("POPLIST ID ROOT ", CONTENT)
RAM_DISK = get_val("POPASL ID RAMDI", CONTENT)
/* Misc */
STRAP_OPTS = get_val("POPLIST ID BOPTS", CONTENT)
KERNEL_OPTS = get_val("POPLIST ID KOPTS", CONTENT)
return 0